package com.yuyu.storage.infrastructure.persisitence.convert;

import cn.hutool.core.bean.BeanUtil;
import com.yuyu.storage.domin.Do.GoodsStockDO;
import com.yuyu.storage.infrastructure.persisitence.po.GoodsStockPO;

import java.util.Objects;

/**
 * @author
 * @version 1.0
 * @description: 库存转换
 * @date 2022/8/10 16:36
 */
public class StockRepositoryConvert {

    public static GoodsStockDO PO2DO(GoodsStockPO po){
        if(Objects.nonNull(po)){
            GoodsStockDO goodsStockDO = new GoodsStockDO();
            BeanUtil.copyProperties(po,goodsStockDO);
            return goodsStockDO;
        }
        return null;
    }


    public static GoodsStockPO DO2PO(GoodsStockDO goodsStockDO){
        if(Objects.nonNull(goodsStockDO)){
            GoodsStockPO goodsStockPO = new GoodsStockPO();
            BeanUtil.copyProperties(goodsStockDO,goodsStockPO);
            return goodsStockPO;
        }
        return null;
    }
}
